{include file='public/head'}
<body>
<style type="text/css" media="screen">
    header {
        color: black;
    }

    .layui-form-label {
        width: 100px;
    }

    .layui-input-block {
        margin-left: 130px;
    }
</style>


<div class="x-body">
    <form class="layui-form" id='mainForm' method="post" action="info">

        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color: red">*</span>公司名称</label>
            <div class="layui-input-block">
                <input type="text" id="name" value="{$data.name}" name="name" lay-verify="required"
                       autocomplete="off" placeholder="请输入公司名称" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color: red">*</span>电话号码</label>
            <div class="layui-input-block">
                <input type="text" id="phone" value="{$data.phone}" name="phone" lay-verify="required"
                       autocomplete="off" placeholder="请输入电话号码" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color: red">*</span>公司邮箱</label>
            <div class="layui-input-block">
                <input type="text" id="email" value="{$data.email}" name="email" lay-verify="required"
                       autocomplete="off" placeholder="请输入公司邮箱" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color: red">*</span>公司地址</label>
            <div class="layui-input-block">
                <input type="text" id="address" value="{$data.address}" name="address" lay-verify="required"
                       autocomplete="off" placeholder="请输入公司地址" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color: red">*</span>允许上传容量</label>
            <div class="layui-input-block">
                {if checkHeadOfficeManage()}
                <input type="number" id="upload_capacity" name="upload_capacity"  value="{$data.upload_capacity|default='不限'}" class="layui-input" lay-verify="required" min="0">
                {else/}
                <input type="text" value="{$data.upload_capacity|default='不限'}" class="layui-input" disabled>
                {/if}
                <span style="position:absolute;top:10px;right:20px;">GB</span>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">已用容量</label>
            <div class="layui-input-block">
                <input type="text" value="{$data.use_capacity|default='不限'}" class="layui-input" disabled>
            </div>
        </div>

        {if checkHeadOfficeManage()}
        <div class="layui-form-item">
            <label class="layui-form-label">启用状态</label>
            <div class="layui-input-block">
                {if $data['status'] == 2}
                <input type="radio" value="1" name="status" title="启用">
                <input type="radio" value="2" name="status" title="禁用" checked>
                {else/}
                <input type="radio" value="1" name="status" title="启用" checked>
                <input type="radio" value="2" name="status" title="禁用">
                {/if}
            </div>
        </div>
        {/if}
        <div class="layui-form-item" style="margin-top: 15px">
            <div>
                <input type="hidden" id="id" name="id" value="{$data.id}">
                <button style="width: 100%" class="layui-btn" lay-submit="" lay-filter="toSubmit">提交保存</button>
            </div>
        </div>

    </form>
    <input type="hidden" id="zindex" name="zindex" value="{$zindex}">
</div>
</body>
{include file='public/foot'}
<script type="text/javascript">
    $(document).ready(function () {
        var form = layui.form;
        var layer = layui.layer;
        var zindex = $("#zindex").val();
        var options = {
            type: 'post',           //post提交
            dataType: "json",        //json格式
            data: {},    //如果需要提交附加参数，视情况添加
            clearForm: false,        //成功提交后，清除所有表单元素的值
            resetForm: false,        //成功提交后，重置所有表单元素的值
            cache: false,
            async: false,          //同步返回
            success: function (data) {
                if (data.code == 0) {
                    layer.msg(data.msg);
                } else {
                    layer.msg(data.msg, {icon: 1, time: 500}, function () {
                        $("#reset").click();
                        x_admin_close();
                        if(zindex == 1){
                            location.reload();
                        }else{
                            parent.location.reload();
                        }
                    });
                }
                //服务器端返回处理逻辑
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                layer.msg('操作失败:服务器处理失败');
            }
        };

        // bind form using 'ajaxForm'
        $('#mainForm').ajaxForm(options).submit(function (data) {
        });
        form.render();
    });
</script>
</html>
